<template>
  <div>
    <van-card
      @click="toDetail(item.houseCode)"
      v-for="item in info"
      :key="item.id"
      :price="item.price"
      :desc="item.desc"
      :title="item.title"
      thumb="https://img01.yzcdn.cn/vant/ipad.jpeg"
    >
      <template #tags>
        <van-tag plain type="danger">{{ item.tags[0] }}</van-tag>
      </template>
    </van-card>
  </div>
</template>

<script>
import axios from 'axios'

export default {
  name: 'FindHome',

  data() {
    return {
      info: null,
    }
  },
  methods: {
    toDetail(id) {
      this.$router.push({
        name: 'detail',
        query: {
          id,
        },
      })
    },
  },
  async created() {
    const { data } = await axios({
      url: ' http://liufusong.top:8080/houses?cityId=AREA%7Cdbf46d32-7e76-1196&stat=1&end=10',
    })
    this.info = data.body.list
  },
}
</script>
<style scoped></style>
